<?php
/*
 * @Description: 短信宝短信类
 * @Author: QianLong
 * @Date: 2019-09-27 16:34:02
 * @LastEditors    : QianLong
 * @LastEditTime   : 2024-01-16 17:05:53
 */

namespace App\Service\Sms;

use Yurun\Util\HttpRequest;

class Smsbao
{
    /**
     * 接口请求
     */
    public function sendRequest($phone, $content, $smsbao_username, $smsbao_password, $smsbao_sign,$extend='')
    {
        $url = 'http://api.smsbao.com/sms?u='. $smsbao_username.'&p='. $smsbao_password.'&m='. $phone.'&c='.urlencode('【'. $smsbao_sign.'】'.$content);
        $http = new HttpRequest;
        $response = $http->get($url);
        $result = $response->body();
        $postData['send_result'] = ($result == '0') ? true : false;
        $postData['send_error'] = $result;
        $postData['send_result_data'] = json_encode($result, JSON_UNESCAPED_UNICODE);
        $postData['smsParam'] = json_encode([]);
        return $postData;
    }
}
